package cn.iocoder.yudao.module.member.agency.vo;

import cn.hutool.core.util.StrUtil;
import cn.iocoder.yudao.framework.business.eligibility.pojo.form.EligibilityApplySaveDTO;
import cn.iocoder.yudao.framework.validation.CitizenIdCard;
import cn.iocoder.yudao.framework.validation.ImageUrl;
import cn.iocoder.yudao.framework.validation.InEnumValue;
import cn.iocoder.yudao.module.api.member.agency.enums.AgencyLevelEnum;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.AssertTrue;
import jakarta.validation.constraints.Pattern;
import lombok.Data;

@Schema(description = "招商人员申请 Request VO")
@Data
public class AppAgencyApplySaveDTO extends EligibilityApplySaveDTO {

    @Schema(description = "级别：1-业务专员、2-业务经理、3-区县合伙人、4-城市合伙人、5-一百零百汉投资人、6-十大元帅投资人、7-五虎上将投资人", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
    @InEnumValue(AgencyLevelEnum.class)
    private Integer level;

    @Schema(description = "身份证号码", example = "522426199*1104****")
    @CitizenIdCard
    private String ownerEidNo;

    @SuppressWarnings("unused")
    @AssertTrue(message = "身份证号码不能为空")
    public boolean validCitizenIdCardNo() {
        return StrUtil.isNotBlank(ownerEidNo);
    }

    @Schema(description = "身份证正面图片地址", example = "https://www.example.com/xxx.jpg")
    @ImageUrl
    private String ownerEidFrontUrl;

    @Schema(description = "身份证反面图片地址", example = "https://www.example.com/yyy.jpg")
    @ImageUrl
    private String ownerEidBackUrl;

    @SuppressWarnings("unused")
    @AssertTrue(message = "身份证照片不能为空")
    public boolean validCitizenIdCardImage() {
        return StrUtil.isNotBlank(ownerEidFrontUrl) && StrUtil.isNotBlank(ownerEidBackUrl);
    }

    @Schema(description = "区县编码", example = "520102")
    @Pattern(regexp = "\\d{6}", message = "区县编码格式错误")
    private String countyCode;

    @SuppressWarnings("unused")
    @AssertTrue(message = "区县编码不能为空")
    public boolean validCountyCode() {
        return StrUtil.isNotBlank(countyCode);
    }

    @Schema(description = "详细地址", example = "花果园金融街5号驰通集团公司")
    private String detailAddress;

    @SuppressWarnings("unused")
    @AssertTrue(message = "详细地址不能为空")
    public boolean validDetailAddress() {
        return StrUtil.isNotBlank(detailAddress);
    }

}
